<template>
    <div class="listContent">
        <div class="listTop">
            <div class="logoTitle">康远财务管理系统</div>
            <div class="userInfo">
                <span class="name">{{userName}}</span>
                <span>|</span>
                <span class="loginOut" @click="nav_exit">退出</span>
            </div>
        </div>
        <div class="hideBox">
            <el-row :gutter="20" style="box-sizing: border-box;margin-left: 0;margin-right: 0;padding-top:20px">
                <el-col :span="2">
                    <div class="labaleTitle">常用筛选</div>
                </el-col>
                <el-col :span="4">
                    <div class="block">
                            <el-date-picker
                                v-model="$store.state.value"
                                type="month"
                                placeholder="开始月份"
                                value-format="yyyy-MM">
                            </el-date-picker>
                    </div>
                </el-col>
                <el-col :span=".5" style="line-height:35px;padding-right:0;padding-left:0">至</el-col>
                <el-col :span="4" style="">
                    <div class="block">
                            <el-date-picker
                                v-model="$store.state.values"
                                type="month"
                                placeholder="结束月份"
                                value-format="yyyy-MM">
                            </el-date-picker>
                    </div>
                </el-col>
                <el-col :span="4">
                    <div class="block">
                        <el-select v-model="$store.state.value1" placeholder="收退款属性">
                            <el-option
                            v-for="item in options"
                            :key="item.state"
                            :label="item.label"
                            :value="item.state">
                            </el-option>
                        </el-select>
                    </div>
                </el-col>
                <el-col :span="4">
                    <div class="block">
                        <el-select v-model="$store.state.value2" placeholder="结算方式">
                            <el-option
                            v-for="item in options1"
                            :key="item.state"
                            :label="item.label"
                            :value="item.state">
                            </el-option>
                        </el-select>
                    </div>
                </el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value3" placeholder="请输入ID" clearable></el-input></div></el-col>
            </el-row>
            <el-row :gutter="20" style="box-sizing: border-box;margin-left: 0;margin-right: 0;margin-bottom:0px;padding-bottom:20px">
                <el-col :span="2"><div class="grid-content"></div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value4" placeholder="请输入应收金额" clearable></el-input></div></el-col>
                <el-col :span=".5" style="line-height:35px;padding-right:0;padding-left:0; color:#fff">至</el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value5" placeholder="请输入应付金额" clearable></el-input></div></el-col>
                <el-col :span="6"><div class="inputText"><el-input v-model="$store.state.value6" placeholder="请输入客户付款单位名称" clearable></el-input></div></el-col>
            </el-row>
        </div>
        <div class="showBox" v-if="show">
            <el-row :gutter="20" style="box-sizing: border-box;margin-left: 0;margin-right: 0">
                <el-col :span="2"><div class="labaleTitle">名称筛选</div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value7" placeholder="请输入广告主名称" clearable></el-input></div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value8" placeholder="请输入投放产品名称" clearable></el-input></div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value9" placeholder="请输入投放媒体名称" clearable></el-input></div></el-col>
                <el-col :span="5"><div class="inputText"><el-input v-model="$store.state.value10" placeholder="请输入结算媒体公司全称" clearable></el-input></div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value11" placeholder="请输入直销，渠道名称" clearable></el-input></div></el-col>
            </el-row>
            <el-row :gutter="20" style="box-sizing: border-box;margin-left: 0;margin-right: 0">
                <el-col :span="2"><div class="labaleTitle">金额筛选</div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value12" placeholder="请输入实收金额" clearable></el-input></div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value13" placeholder="请输入应收余额" clearable></el-input></div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value14" placeholder="请输入预收余额" clearable></el-input></div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value15" placeholder="请输入客户退款金额" clearable></el-input></div></el-col>
            </el-row>
            <el-row :gutter="20" style="box-sizing: border-box;margin-left: 0;margin-right: 0">
                <el-col :span="2"><div class="grid-content"></div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value16" placeholder="请输入实付金额" clearable></el-input></div></el-col>
                <el-col :span="4"><div class="inputText"><el-input v-model="$store.state.value17" placeholder="请输入媒体退款金额" clearable></el-input></div></el-col>
            </el-row>
            <el-row :gutter="20" style="box-sizing: border-box;margin-left: 0;margin-right: 0;margin-bottom:0;padding-bottom:30px">
                <el-col :span="2"><div class="labaleTitle">发票筛选</div></el-col>
                <el-col :span="4">
                    <div class="block">
                        <el-select v-model="$store.state.value18" placeholder="请选择客户是否开发票">
                            <el-option
                            v-for="item in options2"
                            :key="item.state"
                            :label="item.label"
                            :value="item.state">
                            </el-option>
                        </el-select>
                    </div>
                </el-col>
                <el-col :span="4">
                    <div class="inputText"><el-input v-model="$store.state.value19" placeholder="请输入客户发票号" clearable></el-input></div>
                </el-col>
                <el-col :span="4">
                    <div class="block">
                        <el-select v-model="$store.state.value20" placeholder="请选择开票类别">
                            <el-option
                            v-for="item in options3"
                            :key="item.state"
                            :label="item.label"
                            :value="item.state">
                            </el-option>
                        </el-select>
                    </div>
                </el-col>
                <el-col :span="4">
                    <div class="inputText"><el-input v-model="$store.state.value21" placeholder="请输入客户价税合计" clearable></el-input></div>
                </el-col>
                <el-col :span="4">
                    <div class="block">
                        <el-select v-model="$store.state.value22" placeholder="请选择媒体是否开票">
                            <el-option
                            v-for="item in options4"
                            :key="item.state"
                            :label="item.label"
                            :value="item.state">
                            </el-option>
                        </el-select>
                    </div>
                </el-col>
            </el-row>
        </div>
        <div class="showOrhide">
            <div class="line">
                <div ></div>
            </div>
            <div class="left">
                <span @click="showHide">{{showOrhideText}}</span>
                <span @click="showHide"><img class="animates" src="../assets/img/jiantou.png" alt=""></span>
            </div>
            <div class="right">
                <el-button id="button" type="primary" round @click="pageListss">查询</el-button>
                <el-button type="primary" round @click="resetting">重置</el-button>
            </div>
        </div>
        <div class="listWra">
            <div class="topBtnBox">
                <el-button type="primary" round @click="importData">导出</el-button>
                <!-- <el-button type="primary" round>导入</el-button> -->
                <el-upload
                    class="upload-demo"
                    :action="apiUrl.mogenApiImport"
                    :with-credentials="true"
                    :on-success="handleSuccess"
                    :beforeUpload="beforeAvatarUpload"
                    :onError="uploadError"
                    :show-file-list="false"
                    :file-list="fileList">
                    <el-button v-if="flags1" type="primary" round>导入</el-button>
                </el-upload>
                <el-button type="primary" round @click="edit"  v-if="flags2">编辑</el-button>
                <el-button type="primary" round @click="deleted" v-if="flags3">删除</el-button>
            </div>
            <div style="margin-bottom:50px">
                <el-table
                    :data="tableData3"
                    border
                    stripe
                    tooltip-effect="dark"
                    style="width: 100%"
                    max-height="600"
                    @selection-change="handleSelectionChange"
                    ref="ttttt"
                    >
                    <el-table-column
                        type="selection"
                        width="58"
                        align="center">
                    </el-table-column>
                    <el-table-column
                        align="center"
                        v-for="(c, i) in table_column"
                        :key="i"
                        :fixed="c.fixed"
                        :sortable="c.sortable"
                        :prop="c.prop"
                        :label="c.label"
                        :formatter="c.format"
                        :width="c.width"
                        min-width="100"
                        v-if="c.visible">
                    </el-table-column>
                </el-table>
            </div>
        </div>
        <div class="bottom">
            <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page.sync ="$store.state.page.currentPage"
            :page-sizes="$store.state.page.sizes"
            :page-size="$store.state.page.limit"
            layout="total, sizes, prev, pager, next, jumper"
            :total="$store.state.page.count">
            </el-pagination>
        </div>
        <div class="upTableBox" v-if="prompt">
            <div class="top">
                <div class="title">导入完成</div>
                <i class="el-icon-close" @click="closeInfo"></i>
            </div>
            <div class="info">
                <span style="padding-right:60px">导入成功数据：<span>{{successNum}}</span></span>
                <span>导入失败数据：<span>{{failedNum}}</span></span>
            </div>
            <div class="wra" style="height:100%;padding-top:100px">
                <el-table
                        height="100%"
                        :data="tableData"
                        border
                        style="width: 100%">
                    <el-table-column
                        align="center"
                        v-for="(c, i) in table_columns"
                        :key="i"
                        :prop="c.prop"
                        :fixed="c.fixed"
                        :label="c.label"
                        :width="c.width"
                    >
                    </el-table-column>
                </el-table>
            </div>
            <!-- <div class="bottomBtn">
                 <el-button type="primary" round @click="closeInfo">确定</el-button>
                 <el-button type="primary" round @click="closeInfo">关闭</el-button>
            </div> -->
        </div>
        <div class="shadowBox" v-if="prompt"></div>
    </div>
</template>
<script>
export default {
    name: 'index',
    data () {
        return {
            flags:true,
            flags1:true,
            flags2:true,
            flags3:true,
            infoLoading:'',
            fileList: [],
            failedNum:0,
            successNum:0,
            prompt:false,
            userName:'',
            checkAll:true,
            show: false,
            flag: true,
            showOrhideText: '打开更多筛选项',
            tableData: [],
            options: [{
                state: '0',
                label: '全部'
            }, {
                state: '1',
                label: '收款'
            }, {
                state: '2',
                label: '退款'
            }],
            options1: [{
                state: '0',
                label: '全部'
            }, {
                state: '1',
                label: 'CPA'
            }, {
                state: '2',
                label: 'CPC'
            }, {
                state: '3',
                label: 'CPA+CPC'
            }],
            options2: [{
                state: '0',
                label: '全部'
            }, {
                state: '1',
                label: '是'
            }, {
                state: '2',
                label: '否'
            }],
            options3: [{
                state: '0',
                label: '全部'
            }, {
                state: '1',
                label: '增值税专用发票'
            }, {
                state: '2',
                label: '增值税普通发票'
            }],
            options4: [{
                state: '0',
                label: '全部'
            }, {
                state: '1',
                label: '是'
            }, {
                state: '2',
                label: '否'
            }],
            tableData3: [
            ],
            multipleSelection: [],
            table_column: [
                {fixed: false, prop: 'settlementDate', label: '结算期间', sortable: false, visible: true,width:100},
                {fixed: false, prop: 'id', label: 'ID', sortable: false, visible: true,width:100},
                {fixed: false, prop: 'advertiser', label: '广告主', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'settlementMode', label: '结算方式', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'product', label: '投放产品', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'belongBackstage', label: '所属后台', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'account', label: '所属账号', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaOpenName', label: '媒体公司全称', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaSettlementName', label: '结算媒体公司全称', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'channelName', label: '所属直销、渠道名称', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'sales', label: '对应销售', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'ownerBody', label: '我方主体', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'receiveRefundAttribute', label: '收退款属性', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerPaymentName', label: '客户付款单位名称', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerSettlementData', label: '客户结算数据', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'accessPrice', label: '接入单价(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'consume', label: '消耗', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerRebateAttribute', label: '客户折扣属性', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerRebateDescribe', label: '客户折扣描述', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerReceiveRefundDate', label: '客户收/退款日期(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerReceiveAmount', label: '应收金额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerOfficialAmount', label: '实收金额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerReceiveBalance', label: '应收余额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerOfficialBalance', label: '预收余额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerRefundAmount', label: '退款金额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerBankReciveRefundNo', label: '银行收/退款流水号', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerInvoiceState', label: '是否开票', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerInvoiceNo', label: '客户发票号', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerInvoiceDate', label: '客户开票日期（天）', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerInvoiceType', label: '客户开票类别', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerInvoiceContent', label: '开票内容', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerInvoiceProduct', label: '开票产品', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerInvoiceAmount', label: '发票金额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerInvoiceTax', label: '税额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'customerPriceTaxTotal', label: '价税合计(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'payBckstageDate', label: '支付后台日期（天）', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaRebateAttribute', label: '媒体折扣属性', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaRebate', label: '媒体折扣描述', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'channelSettlementData', label: '渠道结算数据', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'releasePrice', label: '投放单价(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'paymentAmount', label: '应付金额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'officialAmount', label: '实付金额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'refundAmount', label: '退款金额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'bankReciveReundNo', label: '银行付/退款流水号', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoiceState', label: '是否收票', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoiceNo', label: '发票号', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoiceDate', label: '媒体开票日期（天）', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoicePurchase', label: '购货单位', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoiceCompany', label: '开票公司名称', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoiceType', label: '媒体开票类别', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoiceContent', label: '开票内容', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoiceProduct', label: '开票产品', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoiceAmount', label: '发票金额(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoiceTax', label: '税额（元）', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'mediaInvoicePriceTaxTotal', label: '价税合计(元)', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'taxMargin', label: '含税毛利（元）', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'remark', label: '备注', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'operator', label: '操作人', sortable: false, visible: true,width:180},
                {fixed: false, prop: 'lastModifyTime', label: '操作时间', sortable: false, visible: true,width:180}
            ],
            table_columns: [
                {fixed: false, prop: 'name', label: '数据位置', sortable: false, visible: true,width:150},
                {fixed: false, prop: 'info', label: '失败原因', sortable: false, visible: true,},
            ],
            cities:[
                '结算期间',
                'ID',
                '广告主',
                '结算方式',
                '投放产品',
                '所属后台', 
                '所属账号',
                '媒体公司全称',
                '结算媒体公司全称',
                '所属直销、渠道名称',
                '对应销售',
                '我方主体',
                '收退款属性',
                '客户付款单位名称',
                '客户结算数据',
                '接入单价(元)',
                '消耗',
                '客户折扣属性', 
                '客户折扣描述',
                '客户收/退款日期(元)',
                '应收金额(元)',
                '实收金额(元)',
                '应收余额(元)',
                '预收余额(元)',
                '退款金额(元)',
                '银行收/退款流水号',
                '是否开票',
                '客户发票号',
                '客户开票日期（天）',
                '客户开票类别',
                '开票内容',
                '开票产品',
                '发票金额(元)',
                '税额(元)',
                '价税合计(元)',
                '支付后台日期（天）',
                '媒体折扣属性',
                '媒体折扣描述',
                '渠道结算数据',
                '投放单价(元)',
                '应付金额(元)',
                '实付金额(元)',
                '退款金额(元)',
                '银行付/退款流水号',
                '是否收票',
                '发票号',
                '媒体开票日期（天）',
                '购货单位',
                '开票公司名称',
                '媒体开票类别',
                '开票内容',
                '开票产品',
                '发票金额(元)',
                '税额（元）', 
                '价税合计(元)',
                '含税毛利（元）',
                '备注',
                '操作人',
                '操作时间',
            ],
            citiesFilterVal: [
                'settlementDate',
                'id', 
                'advertiser',
                'settlementMode',
                'product', 
                'belongBackstage',
                'account',
                'mediaOpenName',
                'mediaSettlementName', 
                'channelName',
                'sales',
                'ownerBody',
                'receiveRefundAttribute',
                'customerPaymentName', 
                'customerSettlementData',
                'accessPrice', 
                'consume',
                'customerRebateAttribute', 
                'customerRebateDescribe', 
                'customerReceiveRefundDate',
                'customerReceiveAmount', 
                'customerOfficialAmount', 
                'customerReceiveBalance', 
                'customerOfficialBalance',
                'customerRefundAmount', 
                'customerBankReciveRefundNo',
                'customerInvoiceState', 
                'customerInvoiceNo', 
                'customerInvoiceDate', 
                'customerInvoiceType', 
                'customerInvoiceContent', 
                'customerInvoiceProduct', 
                'customerInvoiceAmount', 
                'customerInvoiceTax', 
                'customerPriceTaxTotal', 
                'payBckstageDate', 
                'mediaRebateAttribute', 
                'mediaRebate', 
                'channelSettlementData', 
                'releasePrice', 
                'paymentAmount',
                'officialAmount', 
                'refundAmount', 
                'bankReciveReundNo', 
                'mediaInvoiceState',
                'mediaInvoiceNo', 
                'mediaInvoiceDate', 
                'mediaInvoicePurchase',
                'mediaInvoiceCompany', 
                'mediaInvoiceType', 
                'mediaInvoiceContent', 
                'mediaInvoiceProduct', 
                'mediaInvoiceAmount',
                'mediaInvoiceTax',
                'mediaInvoicePriceTaxTotal',
                'taxMargin',
                'remark',
                'operator',
                'lastModifyTime',
            ],
            idArr:[],
            isFirstEnter:false,
            listLoading:'',
            importDataList:[],
            listLoadImport:''
        }
    },
    created () { 
        switch(sessionStorage.userType){
            case '1':
            console.log(1)
                this.flags2=false;
                this.flags3=false;
                break;
            case '2':
            console.log(2)
                this.flags1=false;
                this.flags2=false;
                this.flags3=false;
                break;
        }
        // this.values = new Date(+new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '').substr(0,7);
        // this.value = this.values.substr(0,6)+(this.values.substr(6,7)-1);
        this.userName = sessionStorage.userName;
        this.pageListss();
    },
    methods: {
        //更多筛选显示隐藏
        showHide () {
            this.flag = !this.flag;
            if (!this.flag) {
                this.show = true;
                this.showOrhideText = '收起更多筛选项';
                $('.animates').addClass('trnas');
            } else {
                this.show = false;
                this.showOrhideText = '打开更多筛选项';
                $('.animates').removeClass('trnas');
            }
        },
        //全选
        handleSelectionChange(val) {
            this.multipleSelection=[];
            this.idArr = [];
            val.forEach(element => {
                this.multipleSelection.push(element.id)
                if(element.id!='总计'){
                    this.idArr.push(element.id)
                }
            });
        },
        /*页码翻页*/
        handleCurrentChange(val) {
            this.$store.state.page.offset = val;
            this.pageListss();
        },
        /*改变每页条数*/
        handleSizeChange(val) {
            this.$store.state.page.limit = val;
            this.pageListss();
        },
        //退出登录
        nav_exit() {
          sessionStorage.clear();
          this.$router.push({path: '/login'});
        },
        //重置
        resetting(){
            this.$store.state.value='';
            this.$store.state.values='';
            this.$store.state.value1='';
            this.$store.state.value2='';
            this.$store.state.value3=null;
            this.$store.state.value4='';
            this.$store.state.value5='';
            this.$store.state.value6='';
            this.$store.state.value7='';
            this.$store.state.value8='';
            this.$store.state.value9='';
            this.$store.state.value10='';
            this.$store.state.value11='';
            this.$store.state.value12='';
            this.$store.state.value13='';
            this.$store.state.value14='';
            this.$store.state.value15='';
            this.$store.state.value16='';
            this.$store.state.value17='';
            this.$store.state.value18='';
            this.$store.state.value19='';
            this.$store.state.value20='';
            this.$store.state.value21='';
            this.$store.state.value22='';
        },
        //编辑
        edit(){
            if(this.multipleSelection.length==0){
                this.$message({
                    message: '请选择一条数据进行编辑',
                    type: 'warning',
                    duration:2000
                });
                return false;
            }
            if(this.multipleSelection.length>1){
                this.$message({
                    message: '只能选择一条数据进行编辑',
                    type: 'warning',
                    duration:2000
                });
                return false;
            }
            if(this.multipleSelection.length==1&&this.multipleSelection[0]=="总计"){
                this.$message({
                    message: '该条数据不能进行编辑',
                    type: 'warning',
                    duration:2000
                });
                return false;
            }
            this.$router.push({path:'/edit',query:{id:this.multipleSelection[0]}})
        },
        //列表数据
        pageListss(){
            this.listLoading= this.$loading({
                lock: true,
                text: '拼命加载中',
                spinner:'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
            console.log(this.$store.state.value1)
            $('.el-table__body-wrapper').scrollTop(0)
            this.$http({
                method:'post',
                url:this.apiUrl.mogenApiSearch,
                data:{
                    limit:this.$store.state.page.limit,
                    offset:this.$store.state.page.offset,
                    settlementSDate : this.$store.state.value,
                    settlementEDate :this.$store.state.values,
                    receiveRefundAttribute :this.$store.state.value1==''?0:this.$store.state.value1,
                    settlementMode :this.$store.state.value2==''?0:this.$store.state.value2,
                    id :this.$store.state.value3,
                    customerReceiveAmount:this.$store.state.value4,
                    paymentAmount :this.$store.state.value5,
                    customerPaymentName:this.$store.state.value6,
                    advertiser :this.$store.state.value7,
                    product :this.$store.state.value8,
                    mediaOpenName :this.$store.state.value9,
                    mediaSettlementName :this.$store.state.value10,
                    channelName :this.$store.state.value11,
                    customerOfficialAmount :this.$store.state.value12,
                    customerReceiveBalance:this.$store.state.value13,
                    customerOfficialBalance :this.$store.state.value14,
                    customerRefundAmount :this.$store.state.value15,
                    officialAmount : this.$store.state.value16,
                    refundAmount :this.$store.state.value17,
                    customerInvoiceState :this.$store.state.value18==''?0:this.$store.state.value18,
                    customerInvoiceNo :this.$store.state.value19,
                    customerInvoiceType :this.$store.state.value20==''?0:this.$store.state.value20,
                    customerPriceTaxTotal :this.$store.state.value21,
                    mediaInvoiceState :this.$store.state.value22==''?0:this.$store.state.value22
                }
            }).then(res=>{
                console.log(res)
                this.listLoading.close();
                var data = res.data.list;
                var allPrice = res.data.totalProperty;
                allPrice.id = '总计';
                this.tableData3 = [allPrice,...data];
                this.$store.state.page.count = res.data.total;
            }).catch();
        },
        //删除数据
        deleted(){
            if(this.idArr.length==0){
                this.$message({
                    message: '请选择需要删除的数据',
                    type: 'warning',
                    duration:2000
                });
                return false;
            }
            this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
                center: true
                }).then(() => {
                    this.$http({
                        method:'post',
                        url:this.apiUrl.mogenApiDelete,
                        data:{ids:this.idArr}
                    }).then(res=>{
                        console.log(res)
                        if(res.data.state==1){
                            this.$message({
                                type: 'success',
                                message: '删除成功!',
                                duration:2000
                            });
                            this.pageListss();
                        }else{
                            this.$message({
                                type: 'error',
                                message: '删除失败!',
                                duration:2000
                            });
                        }
                    }).catch()
                }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除',
                    duration:2000
                });
            });
        },
        //导出数据
        importData() {
            var that = this;
            this.listLoadImport= this.$loading({
                lock: true,
                text: '正在导出数据,请稍后....',
                spinner:'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
            return new Promise(function(resolve,reject){
                that.$http({
                    method:'post',
                    url:that.apiUrl.mogenApiSearch,
                    data:{
                        limit:that.$store.state.page.limit,
                        offset:that.$store.state.page.offset,
                        all:true,
                        settlementSDate : that.$store.state.value,
                        settlementEDate :that.$store.state.values,
                        receiveRefundAttribute :that.$store.state.value1==''?0:that.$store.state.value1,
                        settlementMode :that.$store.state.value2==''?0:that.$store.state.value2,
                        id :that.$store.state.value3,
                        customerReceiveAmount:that.$store.state.value4,
                        paymentAmount :that.$store.state.value5,
                        customerPaymentName:that.$store.state.value6,
                        advertiser :that.$store.state.value7,
                        product :that.$store.state.value8,
                        mediaOpenName :that.$store.state.value9,
                        mediaSettlementName :that.$store.state.value10,
                        channelName :that.$store.state.value11,
                        customerOfficialAmount :that.$store.state.value12,
                        customerReceiveBalance:that.$store.state.value13,
                        customerOfficialBalance :that.$store.state.value14,
                        customerRefundAmount :that.$store.state.value15,
                        officialAmount : that.$store.state.value16,
                        refundAmount :that.$store.state.value17,
                        customerInvoiceState :that.$store.state.value18==''?0:that.$store.state.value18,
                        customerInvoiceNo :that.$store.state.value19,
                        customerInvoiceType :that.$store.state.value20==''?0:that.$store.state.value20,
                        customerPriceTaxTotal :that.$store.state.value21,
                        mediaInvoiceState :that.$store.state.value22==''?0:that.$store.state.value22
                    }
                }).then(res=>{
                    var data = res.data.list;
                    var allPrice = res.data.totalProperty;
                    allPrice.id = '总计';
                    that.importDataList = [allPrice,...data];
                    that.$store.state.page.count = res.data.total;
                    resolve(that.importDataList)
                }).catch();
            }).then(
                function(data){
                    if (data.length == 0) {
                        that.$message({
                            type: 'error',
                            message: '导出失败,请稍后再试!'
                        });
                        return false;
                    }
                    let tHeader = that.cities;
                    let filterVal = that.citiesFilterVal;
                    let importData = data;
                    // let searchName = [this.value, this.values, '实时数据'];
                    let sqlName = ['康远财务报表','('+that.$store.state.value+'月', that.$store.state.values+'月)',];
                    // let fileName = (this.isSearch ? searchName : sqlName).join('_');
                    let fileName = sqlName.join('-');
                    that.handleDownload(tHeader, filterVal, importData, fileName);
                    that.listLoadImport.close();
                }
            )
        },
        // 导出xls数据
        handleDownload(theader, filterval, tabledata, filename) {
            require.ensure([], () => {
                const {export_json_to_excel} = require('@/vendor/Export2Excel');
                const tHeader = theader;
                const filterVal = filterval;
                const list = tabledata;
                const data = this.formatJson(filterVal, list);
                export_json_to_excel(tHeader, data, filename);
            });
        },
        formatJson(filterVal, jsonData) {
            return jsonData.map(v => filterVal.map(j => v[j]));
        },
        //上传成功
        handleSuccess(response, file, fileList) {
            console.log(response)
            this.infoLoading.close()
            if(response.status==1){
                this.prompt = true;
                this.tableData = response.msg;
                this.failedNum = response.failedNum;
                this.successNum= response.successNum
            }else{
                this.$message({
                    type: 'error',
                    message: '上传失败，请重试'
                });
            }
        },
        // 上传错误
        uploadError(err, file, fileList) {
            console.log(err)
            this.infoLoading.close()
            this.$message({
                type: 'error',
                message: '上传失败，请重试'
            });
        },
        // 上传前的操作
        beforeAvatarUpload(file) {
            this.infoLoading = this.$loading({
                lock: true,
                text: 'Loading',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
        },
        //关闭错误信息
        closeInfo(){
            this.prompt = false;
        }
    }
}
</script>
<style>
.listContent {
  width: 100%;
  height: 100%;
  background: #f5f5f5;
  min-width: 1380px;
  overflow: scroll;
}
.listContent .listTop {
  width: 100%;
  height: 80px;
  background: #107cd7;
  position: relative;
}
.listContent .listTop .logoTitle {
  line-height: 80px;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  padding-left: 40px;
}
.listContent .listTop .userInfo {
  position: absolute;
  right: 40px;
  top: 0;
  line-height: 80px;
  color: #fff;
  font-size: 16px;
}
.listContent .listTop .userInfo .name {
  padding-right: 20px;
}
.listContent .listTop .userInfo .loginOut {
  padding-left: 20px;
  cursor: pointer;
}
.listContent .hideBox {
  margin: 20px 40px 0 40px;
  background: #fff;
}
.listContent .showBox {
  margin: 0 40px;
  background: #fff;
}
.listContent .el-row {
  margin-bottom: 20px;
  font-size: 12px;
}
.listContent .el-col {
  border-radius: 4px;
}
.listContent .bg-purple-dark {
  background: #99a9bf;
}
.listContent .bg-purple {
  background: #d3dce6;
}
.listContent .bg-purple-light {
  background: #e5e9f2;
}
.listContent .grid-content {
  border-radius: 4px;
  height: 35px;
}
.listContent .row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
.listContent .labaleTitle {
  line-height: 35px;
  color: #107cd8;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
}
.listContent .block {
  width: 100%;
  height: 100%;
}
.listContent .block .el-select {
  width: 100%;
}
.listContent .block .el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: 100%;
  height: 100%;
}
.listContent .block .el-input__inner {
  height: 35px;
  line-height: 35px;
}
.block .el-input__inner::placeholder {
  color: #999 !important;
}
.block .el-input__inner::-webkit-input-placeholder{
    color: #999 !important;
}
.block .el-input__icon{
    line-height: 35px;
}
.listContent .inputText .el-input .el-input__inner {
  line-height: 35px;
  height: 35px;
}
.inputText .el-input__inner::placeholder {
  color: #999;
}
.inputText .el-input__inner::-webkit-input-placeholder {
  color: #999;
}
.listContent .showOrhide {
  margin: 0 40px;
  height: 80px;
  line-height: 80px;
  color: #107cd8;
  font-size: 14px;
  background: #fff;
  padding-left: 15px;
  font-weight: 700;
  padding-right: 15px;
  position: relative;
}
.listContent .showOrhide .line {
  width: 100%;
  height: 1px;
}
.listContent .showOrhide .line div{
  width: 100%;
  height: 100%;
  background: #ededed;
}
.listContent .showOrhide .left img{
    padding-left: 4px;
    width: 16px;
    height: auto;
    vertical-align: middle;
}
.listContent .showOrhide .left{
    margin-left: 16px;
}
.listContent .showOrhide .left span{
    cursor:pointer;
}
.trnas{
    transform: rotateX(180deg)
}
.listContent .right{
    position: absolute;
    right: 40px;
    top: 0;
}
.listContent .right .el-button--primary{
    background-color: #107cd8;
    border-color: #107cd8;
}
.listContent .right img{
    width: 85px;
    height: auto;
    vertical-align: middle;
    padding-left: 20px;
}
.listContent .right .el-button.is-round{
    border-radius: 4px;
    padding: 5px 16px;
    margin-left: 10px;
}
.listContent .el-col-2{
    width: 120px;
}
.listContent .listWra{
    background: #fff;
    margin: 20px 40px 0 40px;
}
.listContent .listWra .topBtnBox{
    padding-top: 20px;
     padding-bottom: 20px;
    padding-left: 40px;
}
.listContent .listWra .topBtnBox .el-button--primary{
    background-color: #107cd8;
    border-color: #107cd8;
}
.listContent .listWra .topBtnBox img{
    width: 86px;
    height: auto;
    vertical-align: middle;
    padding-left: 20px;
}
.listContent .listWra .el-button.is-round{
    border-radius: 4px;
    padding: 5px 16px;
    margin-right: 10px;
}
.bottom{
    margin-bottom: 50px;
    text-align: center;
}
.upload-demo{
    display: inline-block;
}
.upTableBox{
    width: 65%;
    height: 450px;
    position: absolute;
    margin: auto;
    left: 0;
    top:0;
    bottom:0;
    right: 0;
    background: #fff;
    z-index: 999;
    box-shadow: 1px 1px 2px 2px rgba(0,0,0,.3);
}
.upTableBox .top{
    width: 100%;
    height: 60px;
    position: absolute;
    left: 0;
    top: 0;
    background: #e0e0e0;
    text-align: center;
}
.upTableBox .top .title{
    height: 100%;
    line-height: 60px;
}
.upTableBox .top .el-icon-close{
    position: absolute;
    right: 10px;
    top: 18px;
}
.upTableBox .top .el-icon-close:before{
    font-size: 24px;
}
.upTableBox .info{
    width: 100%;
    height: 40px;
    position: absolute;
    left: 0;
    top: 60px;
    line-height: 40px;
    padding-left: 30px;
}
.upTableBox .bottomBtn{
    width: 100%;
    height: 60px;
    position: absolute;
    left: 0;
    bottom:0;
    display: flex;
    display: -webkit-flex;
    align-items: center;
    justify-content: space-around;
}
.upTableBox .bottomBtn .el-button--primary{
    background-color: #107cd8;
    border-color: #107cd8;
    height: 32px;
}
.upTableBox .bottomBtn .el-button.is-round{
    padding: 8px 23px;
}
.shadowBox{
    position: fixed;
    z-index: 998;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.5)
}
.el-button+.el-button{
    margin-left: 0;
}
</style>

